patman: make "No recipient" checking more tolerant
authorMasahiro Yamada <[email protected]>
Fri, 18 Jul 2014 05:23:20 +0000 (14:23 +0900)
committerSimon Glass <[email protected]>
Mon, 28 Jul 2014 03:57:24 +0000 (04:57 +0100)
If Series-to tag is missing, Patman exits with a message
"No recipient".

This is just annoying for those who had already added
sendemail.to configuration.

I guess many developers have

  [sendemail]
          to = [email protected]

in their .git/config because the 'To: [email protected]' field
should always be added when sending patches.

That seems more reasonable rather than adding
'Series-to: [email protected]' to every patch series.

Patman should exit only when both Series-to tag and sendemail.to
configuration are mising.

Signed-off-by: Masahiro Yamada <[email protected]>
Cc: Simon Glass <[email protected]>
Acked-by: Simon Glass <[email protected]>
tools/patman/gitutil.py

index 7b75c83a82c07c0d8e3f502c11f4f9b0f3b598d8..65754f5326dbc8d92317648e9a4e78ddcaf600a2 100644 (file)
@@ -377,9 +377,14 @@ def EmailPatches(series, cover_fname, args, dry_run, raise_on_error, cc_fname,
     """
     to = BuildEmailList(series.get('to'), '--to', alias, raise_on_error)
     if not to:
-        print ("No recipient, please add something like this to a commit\n"
-            "Series-to: Fred Bloggs <[email protected]>")
-        return
+        git_config_to = command.Output('git', 'config', 'sendemail.to')
+        if not git_config_to:
+            print ("No recipient.\n"
+                   "Please add something like this to a commit\n"
+                   "Series-to: Fred Bloggs <[email protected]>\n"
+                   "Or do something like this\n"
+                   "git config sendemail.to [email protected]")
+            return
     cc = BuildEmailList(series.get('cc'), '--cc', alias, raise_on_error)
     if self_only:
         to = BuildEmailList([os.getenv('USER')], '--to', alias, raise_on_error)